package com.allscore.storm.demo.storm;

import java.math.BigDecimal;

public class Test1 {
    public static BigDecimal _002(BigDecimal num1, BigDecimal num2, String type, int point) {

        BigDecimal result = null;

        switch (type) {
            case "+":
                result = num1.add(num2).setScale(point, BigDecimal.ROUND_DOWN);
                break;
            case "-":
                result = num1.subtract(num2).setScale(point, BigDecimal.ROUND_DOWN);
                break;
            case "*":
                result = num1.multiply(num2).setScale(point, BigDecimal.ROUND_DOWN);
                break;
            case "/":
                result = num1.divide(num2, point, BigDecimal.ROUND_DOWN);
                break;
        }
        return result;
    }


    public static void main(String[] args) {

        BigDecimal num1 = new BigDecimal("2.00111");
        BigDecimal num2 = new BigDecimal("1.21601");
        System.out.println(_002(num1, num2, "-", 2));

    }
}
